#ifndef APPLICATION_H
#define APPLICATION_H

#include <defs/export.h>
#include <defs/global.h>

#include <QtDeclarative>
#include "plugin.h"
#include <QtCore>

namespace Optra {

    namespace Extensions{

        class Context;
        class MainWindow;
        O_PRIVATE_DECLARE(Application);
        class EXTENSIONS_EXPORT Application : public Plugin {
            Q_OBJECT
            Q_PROPERTY(MainWindow* mainWindow READ mainWindow WRITE setMainWindow)
            Q_PROPERTY(QDeclarativeItem* mainItem READ mainItem WRITE setMainItem)

        public:

            void setMainWindow(MainWindow* wnd);
            MainWindow* mainWindow()const;

            void setMainItem(QDeclarativeItem* wnd);
            QDeclarativeItem* mainItem()const;

            QDeclarativeListProperty<QObject> data();

            Application();
            Application(const ContextPtr& ctx, Opl::Core::EntityObject *parent = 0);
            virtual ~Application();

        public slots:
            virtual void Setup(Type type, const Optra::Extensions::ContextPtr& ctx);
        signals:            
            void Start();
        private:
            O_PRIVATE_DECLARE_MEMBER(Application)
      };

    }}

QML_DECLARE_TYPE(Optra::Extensions::Application)
Q_DECLARE_INTERFACE(Optra::Extensions::Application, "org.optra.Extensions.Application/1.0")

#endif // APPLICATION_H

